import request from '@/utils/request'

// 获取所有角色列表
export const reqGetSysRole = (page, pagesize) => {
  return request({
    url: '/sys/role',
    method: 'get',
    params: {
      page,
      pagesize
    }
  })
}

// 新增角色
export const reqAddSysRole = (data) => {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

// 根据ID删除角色
export const reqDelSysRole = (id) => {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

// 根据ID获取角色详情
export const reqGetDetailSysRole = (id) => {
  return request({
    url: `/sys/role/${id}`,
    method: 'get'
  })
}

// 根据ID更新角色
export const reqUpdateSysRole = (data) => {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}

// 给角色分配权限
export function reqAssignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}

